#include "dummyrow.h"

#include <QStandardItem>

DummyRow::DummyRow(
    const QString &text
,   const QIcon &icon)
{
    m_firstItem = new QStandardItem(icon, text);
    m_firstItem->setEditable(false);

    for(uint i = 0; i < 3; ++i)
    {
        m_dummyItem[i] = new QStandardItem();
        m_dummyItem[i]->setEditable(false);
    }
    emit columnWidthChanged(0);
}

DummyRow::~DummyRow()
{
    delete m_firstItem;

    for(uint i = 0; i < 3; ++i)
        delete m_dummyItem[i];
}

QList<QStandardItem*> DummyRow::items() const
{
    return QList<QStandardItem*>()
        << m_firstItem
        << m_dummyItem[0]
        << m_dummyItem[1]
        << m_dummyItem[2];
}

const bool DummyRow::hasItemInRow(QStandardItem *item) const
{
    return items().contains(item);
}

const int DummyRow::row() const
{
    return m_firstItem->row();
}

void DummyRow::setText(const QString &text)
{
    m_firstItem->setText(text);
    emit columnWidthChanged(0);
}

void DummyRow::setIcon(const QIcon &icon)
{
    m_firstItem->setIcon(icon);
}
